package com.android.home.adapter.holder;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.android.common.base.rv.BaseRvHolder;
import com.android.home.R;
import com.android.home.mvp.model.home.MsgSwitchResponseBean;

public class MyInfoHolder extends BaseRvHolder<MsgSwitchResponseBean.UserInfoVoBean>
        implements View.OnClickListener {

    public static final int TYPE_MY_INFO = 100;

    private Context mContext;
    private final ImageView mIvAvatar;
    private final TextView mTvName;
    private final TextView mTvSex;
    private final TextView mTvRole;
    private final TextView mTvMobile;


    public MyInfoHolder(View itemView) {
        super(itemView);
        mContext = itemView.getContext();
        mIvAvatar = itemView.findViewById(R.id.iv_avatar);
        mTvName = itemView.findViewById(R.id.tv_name);
        mTvSex = itemView.findViewById(R.id.tv_sex);
        mTvRole = itemView.findViewById(R.id.tv_role);
        mTvMobile = itemView.findViewById(R.id.tv_mobile);
        initEvent();
    }

    private void initEvent() {
        mIvAvatar.setOnClickListener(this);
    }

    @Override
    public void bindData(MsgSwitchResponseBean.UserInfoVoBean bean, int position) {
        mTvName.setText("奥巴马");
        mTvSex.setText("男");
        mTvRole.setText("美国总统-奥巴马");
        mTvMobile.setText("18600219688");
        mIvAvatar.setImageResource(com.android.resource.R.mipmap.boy_avatar);
    }

    @Override
    public void onClick(View view) {
        if (mChildViewClickListener != null) {
            mChildViewClickListener.onChildViewClick(view, getAdapterPosition());
        }
    }
}
